﻿using MathNet.Numerics;
using MathNet.Numerics.Distributions;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Storage;

namespace UtilZ.Dotnet.MathNetEx.LinearAlgebra
{
    internal class DoubleVectorBuilderEx : VectorBuilder<double>
    {
        private static readonly DoubleVectorBuilderEx _builder = null;
        public static DoubleVectorBuilderEx Builder
        {
            get { return _builder; }
        }

        static DoubleVectorBuilderEx()
        {
            _builder = new DoubleVectorBuilderEx();
        }


        public DoubleVectorBuilderEx()
        {

        }

        public override double Zero => 0d;

        public override double One => 1d;

        public override Vector<double> Dense(DenseVectorStorage<double> storage)
        {
            return new DenseVector(storage);
        }

        public override Vector<double> Sparse(SparseVectorStorage<double> storage)
        {
            return new SparseVector(storage);
        }

        public override Vector<double> Random(int length, IContinuousDistribution distribution)
        {
            return Dense(Generate.Random(length, distribution));
        }
    }
}
